﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LibMinecraft.Model;
using LibMinecraft.Server;

namespace PartyCraftServer.Commands
{
    public class WeatherCommand : Command
    {
        public override bool RequiresOp
        {
            get { return true; }
        }

        public override string DefaultCommand
        {
            get { return "weather"; }
        }

        public override string Documentation
        {
            get { return "Turns the weather on or off.\nUsage: /weather [on|off]"; }
        }

        public override void ExecuteCommand(RemoteClient client, params string[] parameters)
        {
            if (parameters.Length != 1)
            {
                client.SendChat(ChatColor.Red + "Invalid parameters.  Use /weather [on|off]");
                return;
            }
            if (parameters[0].ToLower() != "on" && parameters[0].ToLower() != "off")
            {
                client.SendChat(ChatColor.Red + "Invalid parameters.  Use /weather [on|off]");
                return;
            }
            PartyCraft.Server.SetWeather(parameters[0].ToLower() == "on");
        }
    }
}
